const Koa = require('koa')
// const router = require('koa-router')()
const router=require('./router')
const static = require('koa-static')
const bodyparser = require('koa-bodyparser')
const app = new Koa()
app.use(bodyparser())
app.use(static(__dirname+'/static/')) // 处理静态文件
app.use(router.routes()) // 启动路由
app.use(router.allowedMethods()) // 当发送了不符合的请求时，会返回 `405 Method Not Allowed` 或 `501 Not Implemented`
app.listen(3000)
console.log('监听3000端口');